# 读取数据
import pandas as pd
data = pd.read_excel('销售表2.xlsx', sheet_name=0)
print(data)

# 检测重复值
print(data.duplicated().sum())
print(data.duplicated(subset=['产品', '成本价']).sum())

# 删除重复值
data1 = data.drop_duplicates(keep='first')
print(data1)

data2 = data.drop_duplicates(subset=['产品', '成本价'], keep='last')
print(data2)

data3 = data.drop_duplicates(subset='产品', keep=False)
print(data3)

# 获取唯一值
unique_values = data['产品'].unique()
print(unique_values)
